<html>
<head><meta charset="utf-8"><title>x.py compiles everything everytime · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20compiles.20everything.20everytime.html">x.py compiles everything everytime</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="208050950"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20compiles%20everything%20everytime/near/208050950" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amjad Alsharafi <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20compiles.20everything.20everytime.html#208050950">(Aug 26 2020 at 04:00)</a>:</h4>
<p>Hello. This is my first time in building the rust codebase, I'm trying to work on <a href="https://github.com/rust-lang/rust/issues/75080">this #75080</a> issue, I'm using the command <br>
<code>python x.py test src/tools/linkchecker library/core</code><br>
which would just need to generate documentation for <code>core</code>, but it would compile the whole <code>rustc_*</code> libraries which takes a lot of time.</p>
<p>Is there anyway through <code>config.toml</code> to fix it?<br>
Sorry if its a small issue, and thanks for the help</p>



<a name="208052402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20compiles%20everything%20everytime/near/208052402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20compiles.20everything.20everytime.html#208052402">(Aug 26 2020 at 04:40)</a>:</h4>
<p>Historically I did that by using <code>--keep-stage 0</code> after the first build -- that way it kept using the existing compiler but recompiled the libraries (core+std+etc) that I'd changed.</p>
<p>Not sure if there's a better way these days, <span class="user-mention" data-user-id="333789">@Amjad Alsharafi</span>.</p>



<a name="208053539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20compiles%20everything%20everytime/near/208053539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amjad Alsharafi <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20compiles.20everything.20everytime.html#208053539">(Aug 26 2020 at 05:12)</a>:</h4>
<p>Actually stage 0 is not being compiled again, just stage 1, I used <code>--keep-stage 1</code> but it did not change anything in terms of speed. <span class="user-mention" data-user-id="125270">@scottmcm</span></p>



<a name="208053572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20compiles%20everything%20everytime/near/208053572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lzutao <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20compiles.20everything.20everytime.html#208053572">(Aug 26 2020 at 05:13)</a>:</h4>
<p>you are just changing doc, use <code>./x.py doc</code> instead.</p>



<a name="208053623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20compiles%20everything%20everytime/near/208053623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lzutao <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20compiles.20everything.20everytime.html#208053623">(Aug 26 2020 at 05:14)</a>:</h4>
<p>And use <code>x.py test src/tools/linkchecker</code> after the doc command succeeded.</p>



<a name="208053906"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20compiles%20everything%20everytime/near/208053906" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amjad Alsharafi <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20compiles.20everything.20everytime.html#208053906">(Aug 26 2020 at 05:22)</a>:</h4>
<p>Thanks <span class="user-mention" data-user-id="209117">@lzutao</span> , actually <code>./x.py doc</code> also tell the errors as if I ran <code>./x.py test src/tools/linkchecker</code>. So its not needed maybe?</p>



<a name="208053977"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20compiles%20everything%20everytime/near/208053977" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lzutao <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20compiles.20everything.20everytime.html#208053977">(Aug 26 2020 at 05:25)</a>:</h4>
<p>sometimes rustdoc generates broken links, linkchecker will find them.</p>



<a name="208061199"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20compiles%20everything%20everytime/near/208061199" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20compiles.20everything.20everytime.html#208061199">(Aug 26 2020 at 07:41)</a>:</h4>
<p><code>./x.py doc library/std</code> should only take a few seconds to run with small changes, and should report intra-doc link errors.  <code>./x.py test src/tools/linkchecker</code> has to do substantially more work (it has to build <em>all</em> documentation, plus building the compiler twice), and I would recommend only running it as the last step. If you need to run it multiple times (such as after making a small doc change), then on subsequent runs you can run <code>./x.py test src/tools/linkchecker --keep-stage=0 --keep-stage=1</code>, and that should only take a few seconds.</p>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> , was there a particular reason the instructions for updating intra-doc links recommend running <code>x.py test library/std</code> (instead of <code>x.py doc</code>)? <code>x.py test</code> doesn't build docs, so it won't catch any documentation issues or intra-doc link errors. For documentation, <code>x.py test --doc library/std</code> should only be necessary if modifying examples.</p>



<a name="208080415"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20compiles%20everything%20everytime/near/208080415" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20compiles.20everything.20everytime.html#208080415">(Aug 26 2020 at 11:41)</a>:</h4>
<p>It was probably a typo, I meant to say run the linkchecker</p>



<a name="208080516"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20compiles%20everything%20everytime/near/208080516" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20compiles.20everything.20everytime.html#208080516">(Aug 26 2020 at 11:43)</a>:</h4>
<p>The instructions are <code>./x.py test src/tools/linkchecker library/std</code> which seems right to me</p>



<a name="208080554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20compiles%20everything%20everytime/near/208080554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20compiles.20everything.20everytime.html#208080554">(Aug 26 2020 at 11:43)</a>:</h4>
<p>I could mention <code>--keep-stage</code> but there are a lot of new contributors on the issue and they were getting confused because it doesn't work the very first time you build</p>



<a name="208084180"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20compiles%20everything%20everytime/near/208084180" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20compiles.20everything.20everytime.html#208084180">(Aug 26 2020 at 12:25)</a>:</h4>
<p>saying to use <code>x.py doc library/std</code> first sounds useful though, I'll add that</p>



<a name="208084351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20compiles%20everything%20everytime/near/208084351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20compiles.20everything.20everytime.html#208084351">(Aug 26 2020 at 12:27)</a>:</h4>
<p>how does this look?</p>
<blockquote>
<p>Run <code>x.py doc library/std</code>. This should <code>warn(broken_intra_doc_links)</code> by default. You can set those warnings to a hard error in <code>config.toml</code> with <code>[rust] deny-warnings = true</code>. If you are modifying links in <code>core</code> or <code>alloc</code>, use <code>library/core</code> or <code>library/alloc</code> instead. Fix any warnings that appear. Once you are ready to make a PR, run <code>./x.py test src/tools/linkchecker library/std</code>, which will make sure there are no broken links. This will compile all of rustc from source, so you may want to run it in the background while working on the links.</p>
</blockquote>



<a name="208094051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20compiles%20everything%20everytime/near/208094051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amjad Alsharafi <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20compiles.20everything.20everytime.html#208094051">(Aug 26 2020 at 13:57)</a>:</h4>
<p>LGTM</p>



<a name="208115994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20compiles%20everything%20everytime/near/208115994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20compiles.20everything.20everytime.html#208115994">(Aug 26 2020 at 16:37)</a>:</h4>
<p>Looks better.  I'm not sure I would really recommend running <code>test library/std</code> for just doc updates, but I guess it's not a bad thing (it just takes a little extra time, maybe 1 to 2 minutes).</p>
<p>I would suggest running tidy, just to check for things like trailing whitespace or whatnot. </p>
<p>BTW, thanks for working on all this! It's quite the flood of changes, so I imagine it's taking a fair bit of time.  I imagine a lot of people will be very happy when intra-doc links are stable.</p>



<a name="208117640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20compiles%20everything%20everytime/near/208117640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20compiles.20everything.20everytime.html#208117640">(Aug 26 2020 at 16:51)</a>:</h4>
<p>ooh tidy is a good idea</p>



<a name="208117681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20compiles%20everything%20everytime/near/208117681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20compiles.20everything.20everytime.html#208117681">(Aug 26 2020 at 16:51)</a>:</h4>
<p>no problem! it's actually gone really quickly, there's been lots of people working on it <span aria-label="heart" class="emoji emoji-2764" role="img" title="heart">:heart:</span></p>



<a name="208117710"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20compiles%20everything%20everytime/near/208117710" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20compiles.20everything.20everytime.html#208117710">(Aug 26 2020 at 16:51)</a>:</h4>
<p>if you look at the tracking issue the only file unclaimed is blocked on being split up :)</p>



<a name="208117728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20compiles%20everything%20everytime/near/208117728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20compiles.20everything.20everytime.html#208117728">(Aug 26 2020 at 16:52)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/75080">https://github.com/rust-lang/rust/issues/75080</a></p>



<a name="208117844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20compiles%20everything%20everytime/near/208117844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20compiles.20everything.20everytime.html#208117844">(Aug 26 2020 at 16:52)</a>:</h4>
<p>and a lot of the ones currently open will be unblocked by the beta bump which fixes lots and lots of bugs</p>



<a name="208118096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20compiles%20everything%20everytime/near/208118096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20compiles.20everything.20everytime.html#208118096">(Aug 26 2020 at 16:54)</a>:</h4>
<blockquote>
<p>Looks better. I'm not sure I would really recommend running test library/std for just doc updates, but I guess it's not a bad thing (it just takes a little extra time, maybe 1 to 2 minutes).</p>
</blockquote>
<p>hmm and it does require building the stage 1 compiler ... maybe I'll just recommend letting CI catch those edge cases</p>



<a name="208118529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20compiles%20everything%20everytime/near/208118529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20compiles.20everything.20everytime.html#208118529">(Aug 26 2020 at 16:58)</a>:</h4>
<p>ok new draft:</p>
<blockquote>
<p>Run <code>x.py doc library/std</code>. This should <code>warn(broken_intra_doc_links)</code> by default. Fix any warnings that appear. Once you are ready to make a PR, run <code>./x.py tidy</code>, which will run <code>rustfmt</code>.<br>
In case of rustdoc bugs, there may be broken links that didn't show up when you ran <code>x.py doc</code>. However, these will be caught by the test suite, so you don't have to check them locally.</p>
</blockquote>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>